﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Modbus
{
	public sealed class CommEventLog
	{
		private readonly short status;
		private readonly int   eventCount;
		private readonly int   messageCount;
		private readonly ReadOnlyCollection<byte> events;

		public CommEventLog(short status, int eventCount, int messageCount, IList<byte> events)
		{
			if (events == null)
			{
				throw new ArgumentNullException("events");
			}

			this.status = status;
			this.eventCount = eventCount;
			this.messageCount = messageCount;
			this.events = new ReadOnlyCollection<byte>(events);
		}

		public short Status
		{
			get { return this.status; }
		}

		public int EventCount
		{
			get { return this.eventCount; }
		}

		public int MessageCount
		{
			get { return this.messageCount; }
		}

		public ReadOnlyCollection<byte> Events
		{
			get { return this.events; }
		}
	}
}
